package com.jdd.fintech.morse.plugin.strategy.context;

import com.alibaba.fastjson.JSONObject;
import com.jdd.fintech.morse.plugin.ecrypts.SymmetricCrypto;
import com.jdd.fintech.morse.plugin.plugconfig.MorsePlugValueConfig;
import com.jddglobal.filter.support.exception.FilterException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author: fengcheng
 * @credit: 2021-12-24 10:58
 * @description: 数据加密策略抽象类
 **/
public abstract class AbstractDataEncryptAndDecryptStrategy {

    /**
     * 日志输出对象 DataEncryptsStrategy
     */
    public static final Logger log = LoggerFactory.getLogger(AbstractDataEncryptAndDecryptStrategy.class);

    /**
     * 数据加密策略接口方法
     * @param plugValueConfig   插件值对象
     * @param jsonObject        请求对象
     * @param scObj             算法对象
     * @return
     * @throws FilterException 方法
     */
    public abstract String dataEncryptsStrategyMethod(MorsePlugValueConfig plugValueConfig, JSONObject jsonObject, SymmetricCrypto scObj) throws FilterException;

    /**
     * 数据解密策略接口方法
     * @param plugValueConfig   插件值对象
     * @param jsonObject        请求对象
     * @param scObj             算法对象
     * @return
     * @throws FilterException 方法
     */
    public abstract String dataDecryptsStrategyMethod(MorsePlugValueConfig plugValueConfig, JSONObject jsonObject, SymmetricCrypto scObj) throws FilterException;

    /**
     * 构建公共请求对象
     * @param plugValueConfig
     * @param tenantId
     * @param productCode
     * @param jsonObject
     * @return
     */
    public abstract String buildCommonRequestObjMethod(MorsePlugValueConfig plugValueConfig, String tenantId, String productCode, JSONObject jsonObject) throws FilterException;
}
